Optimal Decision Theory for Diagnostic Testing: Minimizing Indeterminate Classes with Applications to Saliva-Based SARS-CoV-2 Antibody Assays

In diagnostic testing, establishing an indeterminate class is an effective way to identify samples that cannot be accurately classified. However, such approaches also make testing less efficient and must be balanced against overall assay performance. We address this problem by reformulating data classification in terms of a constrained optimization problem that (i) minimizes the probability of labeling samples as indeterminate while (ii) ensuring that the remaining ones are classified with an average target accuracy X. We show that the solution to this problem is expressed in terms of a bathtub principle that holds out those samples with the lowest local accuracy up to an X-dependent threshold. To illustrate the usefulness of this analysis, we apply it to a multiplex, saliva-based SARS-CoV-2 antibody assay and demonstrate up to a 30 % reduction in the number of indeterminate samples relative to more traditional approaches.


Introduction
The SARS-CoV-2 pandemic has highlighted the importance of antibody testing as a means to monitor the spread of diseases such as COVID-19 (Lerner et al. (2020), FDA (2020)). But the widespread deployment of new assays has also revealed fundamental problems in the ability to analyze reliably the corresponding measurements. Early on, this shortcoming was attributed to low prevalence, which made it difficult to distinguish true and false positives (Bond et al. (2020)). However, it soon became clear that there were deeper issues related to statistical interpretation of raw data, suggesting the need to revisit the underlying theory of diagnostic classification (Bermingham et al. (2020), Patrone & Kearsley (2021), Böttcher et al. (2022)).
In this context, a fundamental problem arises when many measurements fall near a cutoff used to distinguish positive and negative samples. The probability of correctly classifying these borderline cases hovers near 50 %, so that even a small fraction thereof can significantly decrease overall accuracy. A common solution is to define a third, indeterminate class for which one cannot draw meaningful conclusions, although this is not always chosen to be near a cutoff (Meyer et al. (2020), Lee et al. (2021), Manthei et al. (2020), Theel et al. (2020), Pisanic et al. (2020), Randad et al. (2021), Heaney et al. (2021)). While this approach increases the average accuracy for those samples that are classified, it also decreases testing efficiency. Thus, there is a need to develop strategies that balance the construction of indeterminate classes against overall assay performance.
The present manuscript addresses this problem by answering the question: what classification scheme (I) minimizes the fraction of indeterminate samples while (II) correctly identifying the remaining ones with a minimum average accuracy X? When an indeterminate class is not permitted, 1 common practice categorizes a sample as positive or negative if its measurement value r falls in a corresponding domain D P or D N ; see Fig. 1. Moreover, it was recently shown that these domains can be optimized by solving an unconstrained optimization problem that maximizes accuracy associated with "binary" classification (Patrone & Kearsley (2021)). In contrast, the present work views (I) and (II) as a constrained optimization problem, with the size of the indeterminate class being the objective and the desired accuracy recast as a constraint. We show that the solution to this problem extends the binary classification result by constructing the smallest indeterminate class via a "bathtub principle" applied to D P and D N : one removes from them the measurements with the lowest probability of being correctly classified up to an Xdependent threshold. As a practical matter, this "waterline" bounding the indeterminate domain can be efficiently and accurately estimated via numerical techniques such as bisection, making our result computationally tractable. We provide examples and numerical validation using a saliva-based, multiplex SARS-CoV-2 antibody test, as well as mathematical proofs of our main results in the Appendix.
At the outset and in contrast with traditional methods, it is important to note that concepts such as specificity and sensitivity per se are not fundamental quantities of interest in our analysis. As discussed in Sec. 6, they describe the accuracy of a fixed classification scheme in two degenerate cases: 0 % and 100 % prevalence. As such, it is trivial (but useless) to optimize either quantity by assigning all samples to a single class. Rather, we demonstrate that it is more useful to define accuracy as a prevalence-weighted, convex combination of specificity and sensitivity, since this naturally interpolates between the aforementioned degenerate cases. This choice also highlights an important (but oftenignored) fact: optimal classification domains, sensitivity, and specificity all change with prevalence. Thus, they are not static metrics of the assay performance in a setting where a disease is actively spreading. For more in-depth discussion, we refer the reader to Ref. (Patrone & Kearsley (2021)), as well as Sec. 6 of the present manuscript.
We also emphasize that the concept of classification accuracy has both a local and global interpretation, and the interplay between these interpretations is fundamental to our analysis. 2 In particular, one can construct over, the adaptive prevalence-estimation algorithm in that work allows us to assume in this work that the prevalence is known. 2 The testing community has largely restricted its attention to global assay properties, since regulatory reporting focuses on assay performance for large populations FDA (2020). conditional probability density functions (PDFs) P (r) and N (r) of a measurement outcome r -i.e. a local property -for (known) positive and negative samples. As shown in Ref. (Patrone & Kearsley (2021)), these PDFs are necessary to maximize the global accuracy X, since the equation defines the boundary between D P and D N when p is the prevalence. In the present work, we recast this observation by showing that P (r) and N (r) also directly define the local accuracy Z(r), and that its global counterpart X is the average value of Z(r). We next observe that the boundary given by Eq.
(1) is the set for which Z = 50 %, its lowest possible value. The corresponding points are the first to be held out, since they contribute most to the average error. 3 Moreover, one sees that systematically removing the least accurate r yields the fastest increase in the global accuracy for the remaining points. The bathtub principle formalizes this idea.
From a practical standpoint, the main inputs to our analysis are training data associated with positive and negative samples; thus our approach is compatible with virtually any antibody assay. These data are used to construct the conditional PDFs P (r) and N (r), so that the classification and holdout problems are reduced to mathematical modeling. This is also the key limitation of our approach insofar as such models are necessarily subjective. However, this problem is not unique to our method. Where possible, we incorporate objective information about the measurement process. See Sec. 4 and Ref. (Patrone & Kearsley (2021)) for a deeper discussion of such issues and other limitations.
The remainder of this manuscript is organized as follows. Section 2 reviews key notation and terminology. Section 3 presents the general theory for defining optimal indeterminate domains. Section 4 illustrates this analysis in the context of a saliva-based, multiplex SARS-CoV-2 saliva assay. Section 5 considers numerical validation of our analysis, and Section 6 concludes with a discussion and comparison with past works. The Appendix provides a proof of our main result and other supporting information.

Notation and Terminology
Our analysis is grounded in measure theory and set theory. We review relevant concepts here. Readers wellversed in these topics may skip this section.
-By a set, we mean a collection of objects, e.g. measurements or measurement values. By a domain, we typically mean a set in some continuous measurement space; see, e.g., Fig. 1. -The symbol ∈ indicates set inclusion. That is, r ∈ A means that r is in set A. -The symbol ∅ denotes the empty set, which has no elements. -The operator ∪ denotes the union of two sets. That is, C = A ∪ B is the set containing all elements that appear in either A or B. -The operator ∩ denotes the intersection of two sets.
That is, C = A ∩ B is the set of elements shared by both A and B. -The operator / denotes the set difference. We write C = A/B to mean the set of all objects in A that are not also in B. Note that in general, A/B = B/A. Equivalently, A/B can be interpreted as the "subtraction" or removal from A of the elements it shares in common with B. -The notation A = {r : * } defines the set A as the collection of r satisfying condition * .
Unless otherwise specified, the "size" or measure of a set refers to the probability of a sample falling within that set, i.e. its probability mass. By the same token, we generally avoid using size to describe the actual dimensions (in measurement space) of a domain. Throughout we also distinguish between training data and test data. The former is used to construct probability models, whereas the latter is the object to which the resulting classification test is applied.

Minimum Probability Indeterminate Class
We begin with the mathematical setting underlying classification. Consider an antibody measurement r, which can be a vector associated with multiple distinct antibody targets. We take the set of all admissible measurements to be Ω. Our goal is to define three domains, D P , D N , and D h associated with positive, negative, and indeterminate (or h for "hold-out") samples. In particular, we say that a test sample r is positive if it falls inside D P (i.e. r ∈ D P ), and likewise for the other domains.
We require that these domains have several basic properties to ensure that they define a valid classification scheme. Recalling that P (r) and N (r) are condi-tional probabilities associated with positive and negative samples, define the measures of a set S ⊂ Ω with respect to P and N to be That is, µ P (S) is the probability of a positive sample falling in S, etc. We then require that and when S = S , for S, S chosen from D P , D N , or D h . Equation (3) states that the probability of any event falling in the positive, negative, or indeterminate domains is one; i.e. any sample can be classified. Equation (4) states that the probability of a sample falling in more than one domain is zero, i.e. a sample has a single classification. Within this context, we define the total error rate to be where p is the prevalence. [See Ref. (Patrone & Kearsley (2021)) for an unbiased method to estimate p without needing to classify.] The terms on the right-hand side (RHS) are the rates of false positives and false negatives. Importantly, indeterminates are not treated as errors in Eq. (5), and E so defined is not the error rate of the assay restricted to samples that fall only within D P and D N . The latter is defined as where D = D P ∪ D N is the set of all samples not in the indeterminate region. Note that Eq. (6) is a conditional expectation; i.e. it is the average error conditioned on the set of samples that can be classified. In Ref. (Patrone & Kearsley (2021)) we showed that when the set Z 1/2 = {r : pP (r) = (1 − p)N (r)} has measure zero and D h is the empty set, 4 E r is minimized by the binary classification scheme for a prevalence p. While D P and D N are not the optimal sets for the problem at hand, they play a fundamental role in the analysis that follows. 5 We also note an important corollary that when the Z 1/2 has non-zero measure, Eqs. (7a) and (7b) are generalized to where Z p and Z n are an arbitrary partition of Z 1/2 . The physical interpretation of this generalization is that any point having equal probability of being negative or positive can be assigned to either class without changing the error. In practice, however, classification often reverts to Eqs. (7a) and (7b) as Z 1/2 has zero measure for many practical PDFs.
In the present work, we assume that there is a desired average accuracy X and that L = 1 − E r [D P , D N ] < X when all samples are classified. Our goal is to define a minimum probability indeterminate class D h and domains D P and D N for which L[D P , D N ] = X; that is, we wish to hold out the fewest samples so that those remaining are classified with the desired accuracy. Mathematically, we seek to minimize where Q(r) = pP (r) + (1 − p)N (r) is the probability of a test sample taking a value r, subject to the constraint that To solve this problem, it is useful to introduce several auxiliary concepts. In particular, define the local accuracy of the unconstrained (i.e. no indeterminate), binary classification to be where D P and D N cover the whole set Ω up to sets of measure zero; moreover, let Z (r) = Z(r, D P , D N ) be the local accuracy of the optimal solution to the binary problem. Then the solution to the constrained problem given by Eqs. (9) and (10) is where Z 0 (X) is the solution to the equation for any set C ⊂ {r : Z (r) = Z 0 } satisfying Eq. (13).
Proof of this result, as well as the strict interpretation of C requires significant analysis of Eq. (10) and is reserved for the Appendix. Here we provide an intuitive interpretation and describe a straightforward algorithm for computing Eqs. (12a)-(12c). Equation (12a) informs that the points to hold out from classification are those with the lowest local accuracy up to some threshold value Z 0 , which depends on X. Equations (12b) and (12c) then amount to the observations that the positive and negative domains are the same as in the unconstrained binary problem, except that we remove the corresponding points with low enough local accuracy. Equation (13) requires that the average local accuracy for the classification sets D P and D N be X. By virtue of the fact that D h = Ω/D, this fixes the boundary of the indeterminate set. That is, the upper bound Z 0 (X) on the indeterminate local accuracy is the lower bound on the accuracy for sets that can be classified. The C(X) is a bookkeeping artifact accounting for the situation in which the set of points with local accuracy Z 0 (X) has non-zero probability mass. In this case, not all of these points need to be held out if doing so would make L greater than X. The choice of which points to make indeterminate then becomes subjective as they all have the same local accuracy. In practice (e.g. for smooth PDFs), C(X) is a set of measure zero with respect to Q, so that we can ignore it in Eq. (12a).
From Eqs. (12a)-(13) it is clear that determining Z 0 (X) is the key step in defining the optimal classification domains. Fortunately, the interpretation afforded by Eq. (13) leads to a straightforward bisection method. First note that 1/2 ≤ Z (r) ≤ 1. Let ζ 0 = 3/4 be an initial guess for the value of Z 0 (X), and let ζ j be the jth update computed iteratively as follows. For each ζ j compute D P (ζ j ), D N (ζ j ), as well as the lefthand side (LHS) of Eq. (13), which we denote by I j .
If |I j | ≤ X for some user-defined tolerance X , or if j reaches some maximum iteration number M , stop the algorithm. In the former case, the classified samples will have an average accuracy L in the range X − X ≤ L ≤ X + X . In the latter case, is the error in the estimate of Z 0 (X). For context, 20 iterations of this algorithm yields errors Z on the order of 1 in 10 7 . In the second case, the existence of a nontrivial set C(X) can be deduced from the observation Fig. 1 Training data associated with the Saliva assay described in Refs. (Pisanic et al. (2020), Randad et al. (2021)). Red x denote known positives (confirmed via polymerase chain-reaction measurements), and blue o denote prepandemic samples, which are assumed to be negative for SARS-CoV-2 antibodies. The bold, horizontal and vertical black lines are cutoffs used to classify samples. Data falling above the horizontal line (red shaded domain) are classified positive; data in the lower right box (shaded blue) are negative, and data in the lower left box (shaded yellow) are indeterminates. The SARS-CoV-2 IgG measurements (vertical axis) are a sum of seven antibody levels measured by the assay, whereas the total IgG measurement (horizontal axis) is the total immunoglobulin-G (IgG) measurement as determined by an enzyme-linked immunosorbent assay (ELISA).
that I j does not converge, but rather cycles between two well-separated values, depending on whether ζ is greater than or less than Z 0 (X). In this case, the set C(X) can be defined arbitrarily but consistent with Eq. (13) once Z 0 (X) is identified to sufficient accuracy.

Example Applied to a Salivary SARS-CoV-2 IgG Assay
To illustrate the analysis of Sec. 3, we consider a salivabased assay described in Refs. (Pisanic et al. (2020), Randad et al. (2021)). We refer the reader to those manuscripts for details of assay design, sample preparation, and measurement processes. For each sample, two measurement values are output: a total immunoglobulin G (IgG) enzyme linked immunosorbent assay (ELISA); and a sum of seven SARS-CoV-2 IgG measurements associated with distinct antigen targets. As a preliminary remark, we observe that the numerical range of the data spans several decades of median fluorescence intensity (MFI), which is difficult to model directly. We also note that the measurements are bounded from below by zero and have a finite upper bound. This motivates us to transform each numerical value d via log 2 [d + 2] − 1, which corresponds representing the data in terms of bits. Empirically we also find that this transformation better separates positive and negative populations. Total IgG values are then rescaled to the domain [0, 1] by dividing each measurement by the maximum. SARS-CoV-2 measurements are similarly rescaled to the domain [0, 1], although we divide the log-transformed data by 7, since there were no samples with saturated values. After transformation, each sample is represented by a two-dimensional vector r = (x, y), where x is the normalized total IgG value, and y is the normalized SARS-CoV-2 counterpart.
The results of this transformation are shown in Fig.  1, along with classification domains currently used with this assay. 6 The goal of the analysis is to maintain ac-curacy while decreasing the number of indeterminate samples by finding the domain D h with the smallest probability mass. We remind the reader that size does not refer to the (generalized) volume in measurement space. Rather it refers to the fraction of samples expected to fall within the domain, since this is what controls the number of indeterminate samples. Thus, it is possible that D h can be quite large when expressed in terms of antibody levels and yet contain very few samples.
To motivate our probability models, we consider the phenomena that could affect measurements. In particular, we anticipate that for positive samples, there should be a degree of correlation between total IgG and SARS-CoV-2 specific antibodies. However, at extreme total IgG values, the SARS-CoV-2 levels may become independent as (i) all measurements will revert to noise when x → −∞ or (ii) SARS-CoV-2 antibody levels will decouple from total antibody levels when the latter is excessively high, e.g. if an individual has been exposed to a large number of different pathogens. We also recognize that the ELISA instrument only reports numerical values on the domain [x min , x max ]. Thus, fluorescence levels above x max are rounded down to the upper bound, and levels below x min are rounded up to the lower bound. As shown in Fig. 1, this has the effect of accumulating data (and thus probability mass) on the lines x = x min and x = x max . While details are reserved for the Appendix, this observation leads us to model positive and negative samples via a PDF of the form (14) where 0 ≤ x ≤ 1, 0 ≤ y < 1, δ(x) is the Dirac delta function, and P 0 (x, y) is assumed to be bounded and continuous on the whole domain. The functions P l (y) and P r (y) characterize the probability of SARS-CoV-2 antibody levels for measurement values saturated at the left (l) and right (r) bounds. We emphasize that the use of delta functions in Eq. (14) is formal and should be treated with care. A more rigorous interpretation of what is meant by Eq. (14) is discussed in the Appendix.
To model the function P 0 (x, y), we treat the total IgG measurements as independent normal random variables with an unknown mean and variance. Within the domain 0 < x < 1 (note the strict inequalities) and 0 ≤ y ≤ ∞, we assume that the SARS-CoV-2 measurements are well described by a Gamma distribution with a fixed (but unknown) scale factor and shape parameter with a sigmoidal dependence on x. This dependence is motivated by the correlation described previ-ously. Taken together, this yields the PDF where µ, σ, θ, and the α j are to-be-determined. The boundary functions are defined to be which describes the probability that a total IgG value below (above) x = 0 (x = 1) will be mapped back to the lower (upper) instrument bound. The free parameters are determined via maximum likelihood estimation using a censoring-based technique; see the Appendix.
As an approximation, we truncate the y-domain to be 0 ≤ y ≤ 1 and renormalize the resulting PDF on this domain. For the negative PDF N (x, y), we anticipate that non-specific binding of the total IgG antibodies to the SARS-CoV-2 antigens will lead to a degree of correlation, albeit to a less extent than for positives. Thus, we use the same form of P (x, y), but refit the parameters using the negative training data. Figure 2 shows the outcome of this exercise for the two training sets. Because P l (y), P r (y), and corresponding terms for N (x, y) are continuous with respect to the Gamma portion of P (x, y) and N (x, y), the former can be inferred from the contour lines in the figure (up to a normalization factor) and are thus not shown. Figures 3 and 4 show Z (r) and waterlines necessary to achieve different average accuracies. The bathtub principle is shown in the latter; see also Ref. (Lieb et al. (2001)) for related ideas. To ensure that L = X, we only hold out samples up to the corresponding value of Z 0 (X). Note that indeterminates are concentrated in regions where there is significant overlap between positive and negative samples. Figure 5 shows the corresponding classification domains computed according to the bathtub principle for a target accuracy of 99.6 %; see also Table 1. Relative to the original classification domains, the analysis reduces the empirical rate of indeterminate samples by more than 11 % while increasing both accuracy and sensitivity of the assay (with empirical specificity remaining constant). See also Fig. 6 Table 1 Summary of fraction of holdouts, sensitivity, and specificity for the data in Figs. 5 and 6. The rectilinear classification method is described in Fig. 1, while the optimal method is given by Eqs. (12a)-(13). For sensitivity, specificity, and accuracy calculations, the numbers in brackets are empirical 95 % confidence intervals. Local accuracy Z (r) of the assay according to the probability models shown in Fig. 2. Note that Z (r) approaches 100 % in regions where P (r) and N (r) do not overlap. Conversely, in regions where the PDFs overlap, it is more challenging to correctly identify samples. Thus Z (r) decreases towards its minimal value of 1/2 in such regions. Note that Z (r) is never less than 1/2 (50/50 odds of correct classification).

Numerical Validation
To validate that the sets D P , D N , and D h obtained in Sec. 3 are optimal, we consider a numerical experiment wherein we perturb H as a function of these domains. For point r ∈ D h and r ∈ D, we formally define a "point-swap derivative" to be In principle Z(r) can be an arbitrary definition of local accuracy, although in practice we take Z(r) = Z (r) Fig. 4 Illustration of the bathtub principle used to compute the minimal probability indeterminate domain. The contour lines are different "waterlines" up to which we can hold out samples. The label on each contour is the local accuracy of the assay. In order to define the indeterminate region, we use the target global accuracy X to define a maximum local accuracy up to which we hold out samples. Increasing the global accuracy of the restricted classification increases the waterline, thereby holding out more samples.
in this section. The interpretation of Eq. (18) is as follows. In taking point r from D and adding it to D h and vice-versa for r, we must ensure that the constraint Eq. (10) remains satisfied. The ratio Z(r)−X Z(r )−X provides the "rate-of-exchange" of probability. For example, if Z(r) − X < Z(r ) − X < 0, then adding r to D will infinitesimally decrease the global accuracy, so that we must hold out a larger yet still infinitesimal fraction of Q in the vicinity of r . It is clear that Eq. (18) goes through a singularity when Z(r ) → X and becomes negative for Z(r ) > X and Z(r) < X. The interpreta- Positive (yellow-green), negative (dark blue), and indeterminate (light-blue) classification domains defined for a theoretical target accuracy of 99.6 % for the training data in the previous figures. Symbols have the same meaning as in previous figures. The empirical accuracy is 98.8 %, with a specificity of 100 % and sensitivity of 96.7 %. The total accuracy is the prevalence-weighted combination of these latter quantities. Note the prevalence is associated with the restricted set of samples that are actually classified; see Sec. 6. Discrepancy between the theoretical and empirical accuracies is due to idealization of the modeling and stochasticity in the data. For comparison, the horizontal and vertical black lines are the same as in Fig. 1 and denote the corresponding classification domains originally used for this assay. The indeterminate region based on the bathtub principle reduces the number of unclassified samples by more than 12 % relative to the original domains while maintaining specificity and improving sensitivity for the training data. See also Table 1 and Sec. 6 for other examples of indeterminate domains.  tion of this is straightforward: we should always reverse any swap for which a point with local accuracy greater than the average is put in the indeterminate class. Such points are not considered in the analysis below. More rigorous interpretations of Eq. (18) are considered in the appendix, especially in the context of the singular PDF given by Eq. (14).
The benefit of Eq. (18) is that it allows us to estimate a "set-partial derivative" by computing the relative probability exchange for any point in the indeterminate domain. In particular, we compute for the optimal domains D h and D . Figure 7 shows the logarithm of Eq. (19) for a mesh of points in the indeterminate region, taking Z(r) = Z (r). Note that swapping any point in the indeterminate region with one in the positive and negative classification domains increases the size of the indeterminate, as expected.
To validate that swapping points between D P and D N does not increase the accuracy of the assay or decrease the size of the indeterminate domain, we examine the quantity Z(r) directly. In particular, the Appendix shows that Z (r) ≥ 1/2 for all r ∈ D guarantees that D P = D P /D h and D N = D N /D h are optimal for the indeterminate region D h . Figure 3 demonstrates that this inequality holds for the solution given by Eqs. (12a)-(13). Thus, no rearrangement of points decreases the size of the indeterminate domain.
6 Discussion: Historical Context, Open Direction, and Limitations

The Role of Prevalence
Examination of Eq. (10) reveals that the terms of the LHS are proportional to prevalence-weighted estimates of sensitivity and specificity. In particular, recognize that are the sensitivity and specificity restricted to the domain D. When there is no indeterminate domain, the normalization factors D P (r)dr = D N (r)dr = 1, so that Eqs. (20a) and (20b) revert to the standard definitions of these quantities. In this case, we see that Eq. (10), which no longer acts as a constraint, amounts to the statement that the prevalence-weighted sum of sensitivity and specificity is equal to X; that is When we permit an indeterminate class, however, the interpretation is not as straightforward. In particular, the presence of the term N Q = D Q(r)dr on the right-hand side (RHS) appears problematic, for note that it implies The normalization factor N Q differs from its counterparts in Eqs. (20a) and (20b). Thus, it is not obvious what our constraint enforces about the sensitivity and specificity of the assay restricted to D.
The resolution to this conundrum is to recognize that the prevalence of the population also changes when we restrict classification to D. This is not to say that the value of p itself (i.e. associated with the total population) changes, but rather that the relative fraction of positives and negatives differs on D ⊂ Ω. This is not unexpected, since the shape of the indeterminate region is a function of the local accuracy Z, which depends on the specifics of the probability models. Mathematically, we understand these observations by rewriting Eq. (22) in the form where N P = D P (r)dr and N N = D N (r)dr are the required normalization constants. Equation (23) becomes an analogue to Eq. (21) of the form where p D = pN P /N Q is the prevalence restricted to the domain D. Note that p D has the properties necessary to be a prevalence: which is a consequence of the definition of N Q . Thus, we see that the constraint corresponds to a domainrestricted-prevalence weighted sum of sensitivity and specificity. From a theoretical standpoint, Eq. (25) is extremely serendipitous. The constraint as defined by Eq. (10) only refers to the prevalence of the full population. It is not obvious that this equation will remain a prevalenceweighted sum when holding out samples, especially as the restricted-prevalence does not in general equal p. Further implications of this observation are explored in the next section.
However, an immediate practical consequence of Eq. (25) is that the relative fraction of positives from an assay using indeterminates is not a reliable estimator of total prevalence. In order for the restricted prevalence p D to equal p, one requires That is, p = p D only occurs when the holdout domain removes equal mass from the probability models, which is extremely restrictive.
To overcome this problem, we recall that Ref. (Patrone & Kearsley (2021)), demonstrated how an unbiased estimate of the total prevalence can be constructed without classifying samples using a simple counting exercise on subdomains of Ω. The validity of that method is independent of the assay accuracy, so that it can be used to estimate p in the present work. Indeed, such techniques are necessary to construct the optimal classification domains, given the fundamental role of p in their definitions. We refer the reader to Ref. (Patrone & Kearsley (2021)) for a deeper discussion of such issues.

Other Notions of Optimality
A common practice in the testing community is to preferentially optimize an assay so that either the specificity or sensitivity reaches a desired target, but not explicitly a linear combination of the two. Equation (24) and the bathtub principle suggest a route by which our method can solve an analogue of this problem. However, a deeper investigation of sensitivity and specificity is first necessary to motivate this generalization and understand how such methods differ from Eqs. (12a)-(13). [See also Ref. (Florkowski (2008)) for additional notions of optimality, as well as Refs. (Algaissi et al. (2020), Grzelak et al. (2020), Hachim et al. (2020)) for other approaches to defining classification domains.] Examination of the binary problem reveals that when p = 1/2, the domains D P and D N equally weight sensitivity and specificity; that is, errors in either are treated as equally undesirable. It is straightforward to show that increasing p will increase sensitivity at the expensive of specificity, and vice versa. The interpretation of this observation is that as the number of positive samples increases, we should increase the size of the positive classification domain so as to capture the their increasing share of the population. It is therefore possible and even likely that when the prevalence approaches 0 or 100 %, either sensitivity or specificity may be unacceptably low, since the corresponding contribution to the total accuracy becomes negligible.
A possible solution to this problem is to recast Eq. (10) as an inequality constraint of the form together with the additional constraints S e ≥ X + (28) where X + and X − are user-defined lower bounds. While an optimal solution to this problem is beyond the scope of the current manuscript, the bathtub principle suggests a construction akin to active-set methods (Nocedal & Wright (2006)). First, solve the optimization problem associated with Eqs. (9)-(10) and check the resulting values of sensitivity and specificity. If these quantities are deemed to small, remove samples up to user-defined waterlines Z n ≥ Z 0 and Z p ≥ Z 0 (which may be different), where Z n and Z p apply only to samples in the negative and positive classification domains. Figure 8 shows an example of this approach applied to the data in previous figures. We originally set X = 0.99 but required that the empirical specificity be 100 % for the training set. To accomplish this, we set Z p = 0.972, Fig. 8 Holdout domain computed with a target accuracy of 99 % and according to the constraints given by inequalities (28) and (29). For the latter, we set X − indirectly by holding out samples up to Zp = 0.972 in the positive classification domain. This yields an empirical specificity of the training data was 100 % while keeping the empirical sensitivity above 94 %. Note that the indeterminate domain (light-blue) is increased only into the positive classification domain (yellow-green) in attempting to satisfy inequality (29). The teal strip adjacent to the light blue and yellow-green is the modified indeterminate domain. After increasing the empirical specificity to 100 %, the optimized domains holds out 15.1 % of samples, as opposed to 22.3 % for the rectilinear method; see Table 1.
which augments the size of the indeterminate domain (teal strip added to the light blue domain) without decreasing the number of true negatives.

Relationship between Prevalence, Sensitivity, and Specificity
Equation (24) and the examples of Secs. (6.1) and (6.2) beg the question: to what extent is prevalence-weighted accuracy a preferred or natural framework for diagnostic classification, as opposed to methods based on explicit reference to sensitivity and specificity? To unravel this, consider that the latter two are purely theoretical properties of a specific choice of classification domain and are only loosely connected to the reality of testing. This is evident from the definitions given by Eqs. (20a) and (20b). The concept of prevalence, i.e. implying existence of a population, does not enter; rather all that is needed is a choice of the classification domains. Thus, an assay can have exceptional sensitivity and yet still be wrong half the time if the prevalence is low. In a related vein, it is clear that specificity and sensitivity only characterize assay accuracy in the limits p → 0 and p → 1, respectively.
Here we encourage a new perspective. As a baseline strategy, the most important task is to correctly classify samples; at least this is of the utmost importance to patients. Moreover, computing accurate prevalence estimates is critical for epidemiologists (although we have shown previously that this problem is solved accurately without recourse to classification). With this goal in mind, the sensitivity and specificity are subservient to accuracy via Eq. (10), and it is not unreasonable to let them change with prevalence if doing so increases overall testing accuracy. We highlight this because under such a paradigm, S e and S p lose their status as the key performance metrics that define the "quality" of an assay, and they cannot be viewed as static properties. Such observations are not to say that S e and S p are useless, however. Clearly there are times when it is more important to correctly identify samples from one class, and this motivates the generalization of Sec. 6.2.
But these observations clarify our perspective of why the prevalence sets a natural scale for classification. In particular, Eq. (10) has two equivalent interpretations: (i) the accuracy of the assay must be X; and (ii) the prevalence-weighted sensitivity and specificity must be X. The equivalence of these interpretations arises from the fact that notions of accuracy assume the existence of a population to which the test is applied. Thus, Eq. (24) is perhaps unsurprising in light of Eq. (10) because both are self-consistent statements about the properties of a population.
The benefit of treating prevalence-weighting as a natural framework for diagnostic classification is that one can easily identify when subjective elements (i.e. not intrinsic to the population) have been added to the analysis. For example, the indeterminate domain in Fig. 8 associated with the inequalities (27) -(29) is not optimal insofar as there is a smaller counterpart that yields the same average accuracy for the classified data. However, it is clear by construction how we have modified the latter, i.e. by adding a user-defined constraint on the specificity. Likewise, even Eq. (10) should be viewed as a subjective modification of the unconstrained, prevalence-weighted classification problem.
Ultimately the choice of classification method is best determined by assay developers, and there may be situations in which prevalence weighting is inappropriate. Nonetheless, we feel that the analysis herein highlights the assumptions behind our work and attempts to ground it in objective elements inherent to the population of interest.

Limitations and Open Directions
A fundamental limitation of our analysis is the assumption that the probabilistic models describing positive and negative samples can be used outside the scope of training data. This problem is common to virtually any classification scheme and is primarily an issue of modeling. Such issues have been explored in a previous manuscript, to which we refer the reader (Patrone & Kearsley (2021)). We note here, however, that modelform errors may introduce uncertainty on the order of a few percent in the conditional probability densities. Thus, it is likely that modeled estimates of accuracy will be incorrect by a proportional amount. This is seen, for example, in the holdout domain computed in Fig. 5. However, Sec. 6.2 provides means of ensuring that the indeterminate domains are recomputed to satisfy any constraints on empirical estimates of accuracy. We also note that approaches that do not explicitly account for prevalence and/or conditional probabilities are likely to have significantly more model-form errors than estimates based on our approach.
Regarding the indeterminate analysis, Eqs. (12a)-(13) and the generalization considered in Sec. 6.2 may be a challenging optimization problem to solve, although the solution could be extremely useful for satisfying regulatory and/or public health requirements. Moreover, formalizing the algorithm described in that section and studying its properties relative to the optimal solution may be useful.
A practical limitation of our analysis is the definition of assay performance, provided we allow for variable, prevalence-dependent classification domains. Current standards advocate using sensitivity and specificity estimated for a single validation population having a fixed prevalence. To realize the full potential of our analysis, it is necessary to (i) estimate assay accuracy and uncertainty therein, (ii) characterize the admissible classification domains, and (iii) compute sensitivities and specificities, all as a function of the variable prevalence. While such issues have been partly considered in (Patrone & Kearsley (2021)), and deeper investigation of this uncertainty quantification is necessary for widespread adoption of these techniques.
Acknowledgements:This work is a contribution of the National Institute of Standards and Technology and is not subject to copyright in the United States. The aforementioned funders had no role in study design, data analysis, decision to publish, or preparation of the manuscript. P.B. was also funded through the NIST PREP grant 70NANB18H162.
Research involving Human Participants and/or Animals: Use of data provided in this manuscript has been approved by: (1) the NIST Research Protections Office; and (2) the Johns Hopkins School of Medicine Internal Review Board.
Data Availability: Analysis scripts and data developed as a part of this work are available upon reasonable request.

A Proof of main result
Lemma 1: Assume that P (r) and N (r) are summable functions on Ω and that the measure of any point r is zero with respect to all distributions. Also assume that L[D P , D N ] < X and that there exists a set of non-zero measure for which Z(r) > X. Then the sets defined by Eqs. (12a)-(13) minimize Eq. (9) subject to Eq. (10).
We first show that Eq. (13) defines Z 0 (X) and C(X). Let 1/2 ≤ ζ ≤ 1 and define Equation (13) motivates the function which is a monotone increasing function of ζ satisfying the inequalities I(1/2) < 0 and I(ζ) > 0 for some ζ > 1/2. Thus, there exists a unique value of Z 0 (X) for which one of two situations holds: either (I) the function I(ζ) is continuous at Z 0 (X) and I(Z 0 (X)) = 0, which directly implies Eq. (13); or (II) I(ζ) suffers a discontinuity, so that I(Z 0 (X)) < 0 and I(Z 0 (X) + ) > 0 for any positive . The latter case occurs when S = {r : Z (r) = Z 0 (X)} has non-zero measure, and we may set C to be any subset C ⊂ S provided Eq. (13) is satisfied. The existence of such a C is guaranteed by the linearity of integration, which implies that is a continuous, monotone increasing function of the measure of C ⊂ S that passes through zero. Any zero ofÎ(C) implies Eq. (13) and defines an appropriate C. The proof that Eqs. (12a)-(13) minimize Eq. (9) relies on the observation that any Z (r) < Z 0 (X) is farther from the mean value X than any Z (r) > Z 0 (X). Thus, it "costs additional probability" to swap points between the indeterminate region and D = D P ∪ D N while satisfying the constraint. To see this mathematically, let D be any other union of positive and negative classification domains satisfying Eq. (10). We do not consider any domains D that consist only of choosing a different subset C ⊂ S while maintaining Eq. (13). By Eq. (10) one find (32) We can further expand the second term as where Z + = {r : Z (r) > X} and Z − = {r : Z 0 (X) < Z (r) < X}. Clearly the first term on the RHS of Eq. (33) is negative, whereas the second term is positive. Noting that Z (r ∈ D ) > Z (r ∈ D h ), one finds by inserting Eq. (33) into Eq. (32) that the latter can be expressed in the form where A(r) > 0, B(r) < 0, and 0 < C(r) < A(r). This implies that Consider now the difference of objective functions By inequality (35), we see that ∆H > 0. Moreover, note that Z(r, D P , D N ) ≤ Z (r) for any classification domains associated with the binary problem. Clearly any choice besides D N and D P entails increasing the measure of D h to ensure that the constraint is satisfied. Figure 1 illustrates that biological phenomena may generate a signal so strong that the instrument saturates, i.e. it reaches a limit xmax above which it cannot distinguish different measurement values. This saturation effectively rounds the "true" measurement down to the xmax. The only conclusion we can draw about a reported value xmax is that the true value χ satisfies the inequality χ ≥ xmax. Similar there exists a lower limit x min up to which smaller measurements values are rounded. The goal of this section is to incorporate such information into probability modeling. For concreteness, we restrict ourselves to the one dimensional measurements x associated with the total IgG assay. We assume that were the optical photodetector not restricted to the range [x min , xmax], the recorded measurement would have been χ returned on the domain −∞ < χ < ∞. Because the measurements have been transformed to a logarithmic coordinate system, χ → −∞ is meaningful. Without additional information about probability of total IgG antibody levels, we make a minimal assumption that χ is described by a Gaussian distribution with an unknown mean µ and variance σ 2 .

B On PDFs with Dirac Masses
Thus, on the open domain (x min , xmax), assume that x = χ, so that the probability of measuring x iŝ However, on the boundaries x min and xmax, we only know that the true values are below and above the respective thresholds. Thus, the probabilities of measuring x min and xmax are given bŷ whereP 0 (χ|µ, σ 2 ) is the same as Eq. (37), but with x replaced by χ. We may then write the full probability model for x aŝ where I(x, a, b) is the indicator function that x is in the open set (a, b). Equation (40) To determine the values of σ and µ, we maximize with respect to these parameters the product of N likelihoods given by or alternatively, we minimize the negative log of L like (x). To construct the two-dimensional PDF associated with Eq. (14), we assume the corresponding probability model for the SARS-CoV-2 IgG measurements and use standard MLE to identify the distribution parameters. The full PDF for training data is then given by the product of the corresponding PDFs for total IgG and SARS-CoV-2 measurements and has the form given by Eq. (14). Note that Eq. (14) does not require modification of the proof in the previous section, since any point (x, y) is a set of measure zero, provided that P l (y) and Pr(y) (and their negative counterparts) are bounded functions of y. However, we do require care in defining the local accuracy and classification domains D N and D P . Let A + = {r : pP 0 (r) > (1 − p)N 0 (r), x min < x < xmax} (43a) B + = {r : pP l (y) > (1 − p)N l (y), x = x min } (43b) C + = {r : pPr(y) > (1 − p)Nr(y), x = xmax} (43c) from which we construct D P = A + ∪ B + ∪ C + and the analogous definition for D N . Note that any point for which the prevalence-weighted probabilities of being negative and positive are identical can be assigned to either class. The corresponding definition of Z (r) is given by pP0(r),(1−p)N0(r)] pP0(r)+(1−p)N0(r) x min < x < xmax max[pP l (y),(1−p)N l (y)] pP l (y)+(1−p)N l (y) x = x min max[pPr (y),(1−p)Nr (y)] pPr (y)+(1−p)Nr (y) where N l (y) and Nr(y) are the analogous of P l (y) and Pr(y) for the negative PDF.

C On the Point-Swap Derivatives
To justify the use of Eq. (18), return to Eq. (10) and consider a set D and its complement D h . Consider balls B = B(r, ) and B = B(r , ) having radii , and centered about r and r . Let these balls be entirely contained in D h and D, respectively. Momentarily assume that the PDFs do not contain Dirac masses. Define D h and D to be the sets where B and B have been interchanged without violating Eq. (10). Taking the difference of Eq. (10) defined relative to D and D yields Assuming that Z(r) and Q(r) are sufficiently smooth, to leading order in , one finds where d is the dimensionality of r. Rearranging this last equation yields Note that d and ( ) d a proportional to the volumes of the respective balls about the points r and r , so that the quantity ( ) d Q(r ) is, for example, the infinitesimal probability mass contained in the corresponding ball. Thus, the given by Eq. (47) is the relative change probability mass exchanged between D and D h in swapping r and r . If we change the class of r (either from D P to D N or vice versa), it may be necessary to hold out additional points r , or it may be possible to move points from the indeterminate into the classification domain. In either case, letting B and B have the same definitions as before and assuming Eq. (10) holds, one finds where B is the ball moved to (+) or from (−) the indeterminate domain, depending on the sign of the first term; note that we also require Z < X inside B . Again taking the limit that the respective are small, one finds Dividing by ±[X − Z(r )] yields the infinitesimal probability mass moved to or from the indeterminate The LHS must be positive, and the denominator on the RHS is positive. Thus, the + and − signs on the RHS occur when Z(r) > 1/2 and Z(r) < 1/2, corresponding to the situations in which probability moves to and from the indeterminate region. Thus, in assessing when D h grows, it is sufficient to test the inequality Z(r) > 1/2. The analysis of this section is easily generalized to the case of Eq. (14) by noting that for points on the lines x = 0 and x = 1, the balls of radius should be taken as intervals on the line with length 2 . This yields the appropriate generalization of probability associated with those points.